<?php $this->header(); ?>
<div class="wrap">

    <!-- start -->
    <div class="nav">
        <ul class="cc">
            <li class="current"><a href="/?g=Admin&m=Index&a=menu">后台菜单</a></li>
        </ul>
    </div>
    <form method="post" class="J_ajaxForm" action="" data-role="list">
        <div class="table_list">
            <table width="100%" id="J_table_list" style="table-layout:fixed;">
                <colgroup>
                    <col width="30">
                    <col width="150">
                    <col width="150">
                    <col width="150">
                </colgroup>
                <thead>
                    <tr>
                        <td></td>
                        <td>菜单名称</td>
                        <td>链接地址</td>
                        <td>操作</td>
                    </tr>
                </thead>
                <?php foreach ($menu as $item): ?>
                    <tr>
                        <td><span class="away_icon"></span></td>
                        <td>
                            <?php echo $item['name'] ?>
                        </td>
                        <td></td>

                        <td>
                            <a href="javascript:void(0);" class="mr10 btn btn_submit" onclick="editSystemMenu('<?php echo $item['menuId'] ?>')" title="编辑">编辑</a>
                            <a href="javascript:void(0);" class="mr10 btn btn_submit" onclick="deleteSystemMenu('<?php echo $item['menuId'] ?>')" >删除</a>
                        </td>
                    </tr>
                    <?php foreach ($item['items'] as $key => $value): ?>
                        <tr>
                            <td>&nbsp;</td>
                            <td><span class="plus_icon  plus_end_icon mr10"></span>
                                <?php echo $value['name']; ?>
                            </td>
                            <td><?php echo $value['url'] ?></td>

                            <td>
                                <a href="javascript:void(0);" class="mr10 btn btn_submit" onclick="editSystemMenu('<?php echo $value['menuId'] ?>')" title="编辑">编辑</a>
                                <a href="javascript:void(0);" class="mr10 btn btn_submit" onclick="deleteSystemMenu('<?php echo $value['menuId'] ?>')" >删除</a></td>
                        </tr>
                    <?php endforeach; ?>
                <?php endforeach; ?>
            </table>

            <table width="100%">
                <tr class="ct">
                    <td><a href="javascript:void(0);" onclick="addSystemMenu()" class="link_add ">添加菜单</a></td>
                </tr>
            </table>

        </div>
        <div class="">
            <div class="btn_wrap_pd">
                <button class="btn btn_submit mr10" type="submit">提交</button>
                <input name="navtype" type="hidden" value="main">
            </div>
        </div>
        <input type="hidden" name="csrf_token" value="2367858f2238a0db">
    </form>

    <!-- end -->

</div>
<div class="pop_cont pop_table" id="editMenu"  style="display: none;">
    <table width="100%" style="table-layout:fixed;">
        <colgroup><col width="80">
            <col>
        </colgroup>
            <tr>
                <th>上级导航</th>
                <td>
                    <span class="must_red">*</span>
                    <select name="parent" class="select_5">
                        <option value="0">顶层菜单</option>
                        <?php foreach($topMenu as $key => $value):?>
                        <option value="<?php echo $value['id'];?>"><?php echo $value['name']; ?></option>
                        <?php endforeach;?>
                    </select>
                </td>
            </tr>
            <tr>
                <th>英文名称</th>
                <td>
                    <span class="must_red">*</span>
                    <input type="text" name="value" class="input input_hd length_5">
                </td>
            </tr>
            <tr>
                <th>中文名称</th>
                <td>
                    <span class="must_red">*</span>
                    <input type="text" name="name" class="input input_hd length_5">
                </td>
            </tr>
            <tr>
                <th>链接地址</th>
                <td>
                    <div class="mb5"><input type="text" name="url" class="input length_5"></div>
                </td>
            </tr>
            <tr>
                <th>顺序</th>
                <td>
                    <input type="text" name="listsort" class="input length_5">
                </td>
            </tr>
        </table>
</div>
<?php $this->footer(); ?>